package com.crm.business.crm.controller;



import com.crm.business.crm.service.ICrmTimeTableService;
import com.crm.common.crm.entity.PO.CrmTimeTable;
import com.crm.common.crm.entity.PO.CrmTimeTableData;
import com.crm.common.ka.core.common.R;
import com.crm.common.ka.core.common.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * 课程排期表 前端控制器
 *
 */
@RestController
@RequestMapping("/crmTimeTable")
@Api(tags = "课程排期表接口")
public class CrmTimeTableController {

    @Autowired
    private ICrmTimeTableService crmTimeTableService;

    @PostMapping("/queryList")
    @ApiOperation("查询列表数据")
    public Result queryList(@RequestBody CrmTimeTable crmTimeTable) {
        return R.ok(crmTimeTableService.queryList(crmTimeTable));
    }

    @PostMapping("/addTimeTable")
    @ApiOperation("新增课程排期")
    public Result addTimeTable(@RequestBody CrmTimeTable crmTimeTable) {
        crmTimeTableService.addTimeTable(crmTimeTable);
        return R.ok();
    }

    @PostMapping("/deleteById")
    @ApiOperation("删除课程排期")
    public Result deleteById(Integer id) {
        crmTimeTableService.deleteById(id);
        return R.ok();
    }

    @PostMapping("/updateClassName")
    @ApiOperation("修改课程排期名称")
    public Result updateClassName(@RequestBody CrmTimeTable crmTimeTable)  {
        crmTimeTableService.updateClassName(crmTimeTable);
        return R.ok();
    }

    @PostMapping("/queryByClassId")
    @ApiOperation("查询讲师期数")
    public Result queryList(Integer id) {
        return R.ok(crmTimeTableService.queryByClassId(id));
    }

    @PostMapping("/addData")
    @ApiOperation("新增讲师期数")
    public Result addData(@RequestBody CrmTimeTableData crmTimeTableData) {
        crmTimeTableService.addData(crmTimeTableData);
        return R.ok();
    }

    @PostMapping("/deleteData")
    @ApiOperation("删除讲师与课程期数")
    public Result deleteData(Integer id){
        crmTimeTableService.deleteData(id);
        return R.ok();
    }

    @PostMapping("/updateData")
    @ApiOperation("修改讲师与课程期数")
    public Result updateData(@RequestBody CrmTimeTableData crmTimeTableData){
        crmTimeTableService.updateData(crmTimeTableData);
        return R.ok();
    }

    @PostMapping("/queryById")
    @ApiOperation("查询列表数据")
    public Result queryById(@RequestParam("id") Integer id) {
        return R.ok(crmTimeTableService.queryById(id));
    }



}
